//Page Object
import { request } from "../../request/index"
Page({
  data: {
    swiperlist: [],
    categorylist: [],
    floorlist: []
  },
  //页面加载时获取数据
  onLoad: function (options) {
    this.getswiperlist(),
      this.getcategorylist(),
      this.getfloorlist()
      wx.setEnableDebug({
        enableDebug: true
      })
      
      // 关闭调试
      wx.setEnableDebug({
        enableDebug: false
      })
   
      
    
  },
  //获取轮播图数据
  async getswiperlist() {
    const res = await request({ url: "https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata" })
    this.setData({
      swiperlist: res.data.message
    })
  },
  //获取导航数据
  async getcategorylist() {
    const res = await request({ url: "https://api-hmugo-web.itheima.net/api/public/v1/home/catitems" })
    this.setData({
      categorylist: res.data.message
    })


  },
  //获取楼层数据
  async getfloorlist() {
    const res = await request({ url: "https://api-hmugo-web.itheima.net/api/public/v1/home/floordata" })
    this.setData({ floorlist: res.data.message })
   
  }
});

